package npcSystem.enemies;

import tools.Constants;
import npcSystem.NPC;


public abstract class Enemy extends NPC{ 
		
	protected boolean canMove;
	
	public Enemy() {
		super();
		spawning = true;
		canMove = true;
	}
	
	public void beingHit(int f, double xv, double yv)
	{
		health -= f;
		
		for(int i = 0; i < Constants.TILE_WIDTH; i++) // mover um tile pra tras, se possivel
    	{
    		me.x += xv;
    		if(me.x < 0) me.x = 0;
    		if(me.x + me.w > curLevel.getLevelWidth()) me.x = curLevel.getLevelWidth() - me.w;
    		if(hitWall(curLevel.getShowingWalls())) me.x -= xv;
    		
    		me.y += yv;
    		if(me.y < 0) me.y = 0;
    		if(me.y + me.h > curLevel.getLevelHeight()) me.y = curLevel.getLevelHeight() - me.h;
    		if(hitWall(curLevel.getShowingWalls())) me.y -= yv;
    	}
		
//		knockedBack = true;
//		imune = true;
	}
	public void beingEated()
	{
		canMove = false;
		dead = true;
	}
	
	public boolean isAttacking()
	{
		return !canMove;
	}
	
}
